package com.pzb.goods.service.impl;

import java.util.List;

import com.pzb.common.core.domain.entity.GdGoodsClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pzb.goods.mapper.GdGoodsClassMapper;
import com.pzb.goods.service.IGdGoodsClassService;

/**
 * 商品分类Service业务层处理
 * 
 * @author pzb
 * @date 2021-09-22
 */
@Service
public class GdGoodsClassServiceImpl implements IGdGoodsClassService 
{
    @Autowired
    private GdGoodsClassMapper GdGoodsClassMapper;

    /**
     * 查询商品分类
     * 
     * @param id 商品分类主键
     * @return 商品分类
     */
    @Override
    public GdGoodsClass selectGdGoodsClassById(Long id)
    {
        return GdGoodsClassMapper.selectGdGoodsClassById(id);
    }

    /**
     * 查询商品分类列表
     * 
     * @param GdGoodsClass 商品分类
     * @return 商品分类
     */
    @Override
    public List<GdGoodsClass> selectGdGoodsClassList(GdGoodsClass GdGoodsClass)
    {
        return GdGoodsClassMapper.selectGdGoodsClassList(GdGoodsClass);
    }

    /**
     * 新增商品分类
     * 
     * @param GdGoodsClass 商品分类
     * @return 结果
     */
    @Override
    public int insertGdGoodsClass(GdGoodsClass GdGoodsClass)
    {
        return GdGoodsClassMapper.insertGdGoodsClass(GdGoodsClass);
    }

    /**
     * 修改商品分类
     * 
     * @param GdGoodsClass 商品分类
     * @return 结果
     */
    @Override
    public int updateGdGoodsClass(GdGoodsClass GdGoodsClass)
    {
        return GdGoodsClassMapper.updateGdGoodsClass(GdGoodsClass);
    }

    /**
     * 删除商品分类信息
     * 
     * @param id 商品分类主键
     * @return 结果
     */
    @Override
    public int deleteGdGoodsClassById(Long id)
    {
        return GdGoodsClassMapper.deleteGdGoodsClassById(id);
    }

    @Override
    public boolean hasChildByClassId(Long id) {
        int count = GdGoodsClassMapper.hasChildByClassId(id);
        return count > 0 ? true : false;
    }

    @Override
    public boolean checkClassExistGoods(Long id) {
        int count = GdGoodsClassMapper.checkClassExistGoods(id);
        return count > 0 ? true : false;
    }

    @Override
    public int changeClassStatusByParentId(GdGoodsClass gdGoodsClass) {
        return GdGoodsClassMapper.changeClassStatusByParentId(gdGoodsClass);
    }
}
